package net.lqy.aipan.config;

import net.lqy.aipan.filter.TimeCostFilter;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @title: TimeCostFilterConfig
 * @Author lqy
 * @Date: 2025-06-07 14:59
 * @Version 1.0
 */
@Configuration
public class TimeCostFilterConfig {
    @Bean
    public FilterRegistrationBean<TimeCostFilter> timeCostFilter() {
        FilterRegistrationBean<TimeCostFilter> registration = new FilterRegistrationBean<>();
        registration.setFilter(new TimeCostFilter());
        registration.addUrlPatterns("/*"); // 拦截所有请求
        return registration;
    }
}
